﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo01
{
    class Program
    {
        public enum Fruits
        {
            葡萄,草莓,奇异果,苹果,香蕉,哈密瓜,西瓜,炸弹
        }
        static void Main(string[] args)
        {
            Random rd = new Random();
            int sum = 0;

            for (int i = 0; i < 10; i++)
            {
                int n = rd.Next(0, 9);
                Fruits fruits = (Fruits)n;
                
                if ((int)fruits!=7)
                {
                    sum = sum + sumscore(fruits);
                    fruitsscore(fruits);
                }
                else
                {
                    fruitsscore(fruits);
                    break;
                }


                //int n = rd.Next(0, 8);
                //Fruits fruits = (Fruits)n;
                //fruitsscore(fruits);
            }

            Console.WriteLine("总分："+sum);
            Console.ReadKey();
        }
        public static void fruitsscore(Fruits fruits)
        {
            switch (fruits)
            {
                case Fruits.葡萄:
                    Console.WriteLine(fruits + ":加10分");
                    break;
                case Fruits.草莓:
                    Console.WriteLine(fruits + ":加8分");
                    break;
                case Fruits.奇异果:
                    Console.WriteLine(fruits + ":加6分");
                    break;
                case Fruits.苹果:
                    Console.WriteLine(fruits + ":加5分");
                    break;
                case Fruits.香蕉:
                    Console.WriteLine(fruits + ":加4分");
                    break;
                case Fruits.哈密瓜:
                    Console.WriteLine(fruits + ":加3分");
                    break;
                case Fruits.西瓜:
                    Console.WriteLine(fruits + ":加2分");
                    break;
                case Fruits.炸弹:
                    Console.WriteLine("切到炸弹，游戏结束");
                    break;
                default:
                    Console.WriteLine("没切到水果");
                    break;
            }
        }
        public static int sumscore(Fruits fruits) 
        {
            int sum = 0;
            switch (fruits)
            {
                case Fruits.葡萄:
                    sum = 10;
                    break;
                case Fruits.草莓:
                    sum = 8;
                    break;
                case Fruits.奇异果:
                    sum = 6;
                    break;
                case Fruits.苹果:
                    sum = 5;
                    break;
                case Fruits.香蕉:
                    sum = 4;
                    break;
                case Fruits.哈密瓜:
                    sum = 3;
                    break;
                case Fruits.西瓜:
                    sum = 2;
                    break;
                case Fruits.炸弹:
                    sum = 0;
                    break;
                default:
                    sum = 0;
                    break;
            }return sum;
        }
    }
}
